// Messenger.cpp: implementation of the CMessenger class.
//
//////////////////////////////////////////////////////////////////////

#include "Messenger.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CMessenger::CMessenger()
{

}

CMessenger::~CMessenger()
{
delete iNumber;

iLogID->Reset();
delete iLogID;
}

void CMessenger::ConstructL(const TDesC &aNumber, TLogId aID)
{
iNumber = aNumber.AllocL();
iLogID=new (ELeave) CArrayFixFlat<TLogId>(2);
iLogID->AppendL(aID);
}

const TDesC& CMessenger::Name()
{
	return *iNumber;
}

void CMessenger::AddLogID(TLogId aID)
{
	iLogID->AppendL(aID);
}

CMessenger* CMessenger::NewL(const TDesC &aNumber, TLogId aID)
{
	CMessenger* self = NewLC(aNumber, aID);
	CleanupStack::Pop(self);
	return self;
}

CMessenger* CMessenger::NewLC(const TDesC &aNumber, TLogId aID)
{
	CMessenger* self = new (ELeave) CMessenger;	//Use default constructor since we're going to overwrite anyway!
	CleanupStack::PushL(self);
	self->ConstructL(aNumber,aID);
	return self;
}
